<?php
/**
 * [domain=xxx]...[/domain]		-> text displayed only on one domain, i.e. [domain=yacs.fr]Test displayed only on yacs.fr[/domain]
 *
 * This code can be used when several sites share one yacs instance
 * It has been originally coded for gresivaudan.org and gresishop.com
 *
 * Author: Christophe Battarel - altairis - christophe@altairis.fr
 *
 */
 
 // [domain=yacs.fr]...[/domain]
 // merge in first place to save some cycles if at the beginning
  $pattern = array_merge(array('/\[domain=([^\]]+?)\](.*?)\[\/domain\]/ise'), $pattern);
  $replace = array_merge(array("render_domain(Codes::fix_tags('$2'), '$1')"), $replace);

	/**
	 * render or not some text depending on domain name
	 *
	 * current domain name is either the real current server name ($_SERVER['SERVER_NAME']), or by the $context['domain'] entry.
	 * If variant is the current domain, then display the block.
	 * Else return an empty string
	 *
	 * @param string the text
	 * @param domain name
	 * @return string the rendered text
	**/
	function &render_domain($text, $domain) { 
    global $context;

    if (($_SERVER['SERVER_NAME'] == $domain)||($context['domain'] == $domain))
      return $text;
    else
      return '';

	}

?>
